<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/common/http.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(..\..\sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="..\..\index.html">All files</a> / <a href="index.html">src/common</a> http.js
    </h1>
    <div class='clearfix'>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/* ====================================== http 请求  ====================================== */
<span class="cstat-no" title="statement not covered" >import axios from 'axios'</span>
<span class="cstat-no" title="statement not covered" >import Config from './config'</span>
<span class="cstat-no" title="statement not covered" >import $fn from './fn'</span>
// ===================================================== antd
// ===================================================== 公共函数
// 错误提法信息
const <span class="fstat-no" title="function not covered" >logMsg = <span class="cstat-no" title="statement not covered" >(</span>msg,content)=&gt;{ <span class="cstat-no" title="statement not covered" >Config.env &amp;&amp; console.log(msg,content) }</span></span>
&nbsp;
// 配置头信息
const <span class="fstat-no" title="function not covered" >config = <span class="cstat-no" title="statement not covered" >(</span>opt)=&gt;{</span>
	let contentType = <span class="cstat-no" title="statement not covered" >opt.upload ? 'multipart/form-data' : 'application/x-www-form-urlencoded';</span>
	let header = <span class="cstat-no" title="statement not covered" >opt.noToken ? </span>
		{ 'Content-Type': contentType } : 
		{ 
			'Content-Type': contentType, 
			'Authorization':$fn.getToken()
		}
<span class="cstat-no" title="statement not covered" >	return {</span>
		baseURL: opt.api,
		headers: header,
		timeout: 30000,
		//withCredentials : true	// 跨域请求想要带上cookies设置为 true
	}
}
// 序列化参数 {a:1,b:2} to ?a=1&amp;b=2
const <span class="fstat-no" title="function not covered" >serializeParam = <span class="cstat-no" title="statement not covered" >(</span>body) =&gt; {</span>
<span class="cstat-no" title="statement not covered" >	if(!$fn.hasObject(body)) <span class="cstat-no" title="statement not covered" >r</span>eturn '';</span>
	let param = <span class="cstat-no" title="statement not covered" >body;</span>
	let str=<span class="cstat-no" title="statement not covered" >'';</span>
<span class="cstat-no" title="statement not covered" >	for(var i in param){</span>
<span class="cstat-no" title="statement not covered" >		if($fn.isValid(param[i])){ <span class="cstat-no" title="statement not covered" >str += i + '=' + param[i] + '&amp;' }</span></span>
	}
<span class="cstat-no" title="statement not covered" >	if (str.charAt(str.length - 1) === '&amp;'){ <span class="cstat-no" title="statement not covered" >str = str.slice(0, str.length - 1) }</span></span>
<span class="cstat-no" title="statement not covered" >	return encodeURI( '?' + str);	// encodeURI 不对 [:, /, ;,?] 进行编码</span>
}
&nbsp;
// 序列化公参及自定义传参
//const combineParam = (body) =&gt; { return serializeParam(LS.get('login')) + serializeParam(body) }
&nbsp;
// 将 body 以函数形式处理
const <span class="fstat-no" title="function not covered" >manageBody = <span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" >b</span>ody =&gt; $fn.isFunction(body) ? body() : body</span></span>
// 给空数据加类型
const <span class="fstat-no" title="function not covered" >setType = <span class="cstat-no" title="statement not covered" >(</span>_this,dataName) =&gt; {</span>
<span class="cstat-no" title="statement not covered" >	if(!_this) <span class="cstat-no" title="statement not covered" >r</span>eturn</span>
	let stack = <span class="cstat-no" title="statement not covered" >_this[dataName]</span>
<span class="cstat-no" title="statement not covered" >	if($fn.isArray(stack)){</span>
<span class="cstat-no" title="statement not covered" >		stack = []</span>
	}else <span class="cstat-no" title="statement not covered" >if($fn.isObject(stack)){</span>
<span class="cstat-no" title="statement not covered" >		stack = {}</span>
	}else{
<span class="cstat-no" title="statement not covered" >		stack = ''</span>
	}
<span class="cstat-no" title="statement not covered" >	if($fn.isValid(dataName)){ <span class="cstat-no" title="statement not covered" >_this[dataName] =  stack  }</span></span>
<span class="cstat-no" title="statement not covered" >	return stack;</span>
}
// http 核心封装
/**
 * defined = {
 * 		onError: ()=&gt;{}		// 只要出错就调用
 * 		suceessHander:()=&gt;{}		// 只要调用接口成功就调用
 * 	    onEnd:()=&gt;{}		// 成功或失败都调用
 * 		error:()=&gt;{}				// 接口请求不通时调用
 * 		closeToast:true				// 数据请求成功但不符合规则时，屏蔽默认提示，可在 then 中自定义提示
 * }
 * 
 * */
const <span class="fstat-no" title="function not covered" >coreRequest = <span class="cstat-no" title="statement not covered" >(</span>url, param, action, defined) =&gt; {</span>
	let UD = <span class="cstat-no" title="statement not covered" >defined || {}</span>
	let api = <span class="cstat-no" title="statement not covered" >url.indexOf('http') !== -1 ? url : Config.api</span>
	let body = <span class="cstat-no" title="statement not covered" >manageBody(param);			// 处理自定义参数的不同形式 {} function</span>
	let sParam = <span class="cstat-no" title="statement not covered" >serializeParam(body);		// 序列化参数</span>
	let <span class="cstat-no" title="statement not covered" >promise;</span>
	let configs = <span class="cstat-no" title="statement not covered" >config({</span>
		upload: UD.upload,
		noToken: UD.noToken,
		api: api
	})
<span class="cstat-no" title="statement not covered" >	$fn.isFunction(UD.onStart) &amp;&amp; UD.onStart()		// 一开始就调用</span>
	
<span class="cstat-no" title="statement not covered" >	if(action === 'get'){</span>
<span class="cstat-no" title="statement not covered" >		promise = axios.get(url + sParam, configs);</span>
<span class="cstat-no" title="statement not covered" >		logMsg('%c' + action + ' === ' + api + url + sParam, 'color:blue')		// 输出 api</span>
	}else{
<span class="cstat-no" title="statement not covered" >		promise = UD.upload||UD.isBody ?  axios.post(url, body, configs) : axios.post(url  + sParam, body, configs);</span>
<span class="cstat-no" title="statement not covered" >		logMsg('%c' + action + ' === ' + api + url + ( UD.upload||UD.isBody ? JSON.stringify(body) : sParam), 'color:blue')		// 输出 api</span>
	}
	
	// 加载效果
<span class="cstat-no" title="statement not covered" >	return new Promise(<span class="fstat-no" title="function not covered" >(</span>resolve, reject) =&gt; {</span>
<span class="cstat-no" title="statement not covered" >		promise.then(<span class="fstat-no" title="function not covered" >res =&gt; </span>{	// 接口正确接收数据处理</span>
			let data = <span class="cstat-no" title="statement not covered" >res.data</span>
			let code = <span class="cstat-no" title="statement not covered" >data.code</span>
			
<span class="cstat-no" title="statement not covered" >			if(code === 200){	// 数据请求成功</span>
<span class="cstat-no" title="statement not covered" >				resolve(data.data)</span>
<span class="cstat-no" title="statement not covered" >				logMsg(url + '===', data.data)</span>
			} else <span class="cstat-no" title="statement not covered" >if(code === 400){	// 登录信息已过期，请重新登录!</span>
<span class="cstat-no" title="statement not covered" >				$fn.toast(data['msg'])</span>
<span class="cstat-no" title="statement not covered" >				$fn.remove()</span>
<span class="cstat-no" title="statement not covered" >				$fn.loginTo()</span>
				// 跳转不同登录页
<span class="cstat-no" title="statement not covered" >				$fn.go('/login')</span>
			}else{ // 数据请求成功但不符合规则
<span class="cstat-no" title="statement not covered" >				reject(data);</span>
					
<span class="cstat-no" title="statement not covered" >				$fn.isFunction(UD.onError) &amp;&amp; UD.onError(data)	// 只要出错就调用</span>
<span class="cstat-no" title="statement not covered" >				$fn.isFunction(UD.onFail) &amp;&amp; UD.onFail(data)	// 数据处理不满足条件时调用</span>
				
<span class="cstat-no" title="statement not covered" >				if(UD.onMsg){</span>
<span class="cstat-no" title="statement not covered" >					$fn.isFunction(UD.onMsg) &amp;&amp; UD.onMsg(data)		// 自定义提示</span>
				}else{
<span class="cstat-no" title="statement not covered" >					$fn.toast(data['msg'],UD.onError)			// 默认开启出错提示</span>
				}
				
<span class="cstat-no" title="statement not covered" >				logMsg(url + '===', data);</span>
			}
<span class="cstat-no" title="statement not covered" >			$fn.isFunction(UD.onEnd) &amp;&amp; UD.onEnd(data)  			// 只要调用接口就调用</span>
<span class="cstat-no" title="statement not covered" >			$fn.isFunction(UD.onSuccess) &amp;&amp; UD.onSuccess(data) 		// 只要调用接口成功就调用</span>
		}, <span class="fstat-no" title="function not covered" >(</span>err) =&gt; { 					// 接口错误处理
<span class="cstat-no" title="statement not covered" >			if(!UD.noError){ <span class="cstat-no" title="statement not covered" >$fn.toast('服务器或网络出错')}</span></span>
<span class="cstat-no" title="statement not covered" >			$fn.isFunction(UD.onNet) 	&amp;&amp; UD.onNet()				// 服务器出错或无网络调用</span>
<span class="cstat-no" title="statement not covered" >			$fn.isFunction(UD.onError) 	&amp;&amp; UD.onError()				// 只要出错就调用</span>
<span class="cstat-no" title="statement not covered" >			$fn.isFunction(UD.onEnd)	&amp;&amp; UD.onEnd()  				// 只要调用接口就调用</span>
			//error(err, api + url)
		})
	})
}
// ===================================================== pull 请求组件
// post 请求
const <span class="fstat-no" title="function not covered" >post = <span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" >(</span>url,body,defined) =&gt; coreRequest(url,body,'post',defined)</span></span>
// get 请求
const <span class="fstat-no" title="function not covered" >get = <span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" >(</span>url,body,defined) =&gt; coreRequest(url,body,'get',defined)</span></span>
// ===================================================== pull 提交
const <span class="fstat-no" title="function not covered" >submit = <span class="cstat-no" title="statement not covered" >(</span>_this,api,option)=&gt;{</span>
	let <span class="cstat-no" title="statement not covered" >opt = {</span>
		param:{},
		loadingText:'数据提交中...',			
		successText:'',					// 自定义成功提示
		succeedFn:'',					// 成功之后执行
		errorText:'',					// 自定义错误提示
		submitLoading:'submitLoading', 	// 加载判断
		loading:true,
		runFirst:true,					// 先跳转，后提示
//		replace:null,					// replace 路由
//		push:null,						// push 路由
//		refresh:false,					// 是否刷新
//		closeToast:false,				// 是否关闭默认提示
//		onEnd:null,			// 无论请求成功或失败都执行此方法
//		onError:null,				//
//		upload:false,					// 调用上传接口
//		noToken:false,
//		isBody:false,
//		isFullApi:false,
		...option
	}
	
<span class="cstat-no" title="statement not covered" >	if(_this) <span class="cstat-no" title="statement not covered" >_</span>this[opt.submitLoading] = true</span>
	
<span class="cstat-no" title="statement not covered" >	opt.loading &amp;&amp; $fn.loading(true,opt.loadingText)</span>
	
	const <span class="fstat-no" title="function not covered" >run = <span class="cstat-no" title="statement not covered" >(</span>)=&gt;{</span>
<span class="cstat-no" title="statement not covered" >		opt.succeedFn &amp;&amp; opt.succeedFn()</span>
	}
	
<span class="cstat-no" title="statement not covered" >	return new Promise(<span class="fstat-no" title="function not covered" >(</span>resolve, reject)=&gt;{</span>
<span class="cstat-no" title="statement not covered" >		post(api,opt.param,{ </span>
			onStart:<span class="fstat-no" title="function not covered" >()=&gt;</span>{ <span class="cstat-no" title="statement not covered" >opt.onStart &amp;&amp; opt.onStart(true) },</span>
			onEnd:<span class="fstat-no" title="function not covered" >()=&gt;</span>{
<span class="cstat-no" title="statement not covered" >				if(_this) <span class="cstat-no" title="statement not covered" >_</span>this[opt.submitLoading] = false</span>
<span class="cstat-no" title="statement not covered" >				opt.loading &amp;&amp; $fn.loading(false)</span>
<span class="cstat-no" title="statement not covered" >				opt.onEnd &amp;&amp; opt.onEnd(false)</span>
			},
			onMsg: opt.onMsg &amp;&amp; ( <span class="fstat-no" title="function not covered" >data =&gt; </span>{ <span class="cstat-no" title="statement not covered" >$fn.isFunction(opt.onMsg) &amp;&amp; opt.onMsg(data) })</span>,
			noError:opt.noError,
			onError:opt.onError,
			upload:opt.upload,
			noToken:opt.noToken,
			isBody:opt.isBody,
		}).then(<span class="fstat-no" title="function not covered" >data=&gt;</span>{
<span class="cstat-no" title="statement not covered" >			resolve(data)</span>
			// 提示后执行
<span class="cstat-no" title="statement not covered" >			if(opt.successText){</span>
<span class="cstat-no" title="statement not covered" >				if(opt.runFirst){</span>
<span class="cstat-no" title="statement not covered" >					$fn.toast(opt.successText)</span>
<span class="cstat-no" title="statement not covered" >					run();</span>
				}else{
<span class="cstat-no" title="statement not covered" >					$fn.toast(opt.successText,run)</span>
				}
			}else{ // 直接执行
<span class="cstat-no" title="statement not covered" >				run();</span>
			}
		},<span class="fstat-no" title="function not covered" >data=&gt;</span>{
<span class="cstat-no" title="statement not covered" >			reject(data)</span>
		})
	})
}
// ===================================================== 一般数据加载
const <span class="fstat-no" title="function not covered" >pull = <span class="cstat-no" title="statement not covered" >(</span>_this,api,option)=&gt;{</span>
	let <span class="cstat-no" title="statement not covered" >opt = {</span>
		dataName:'data',				// 数据名字
		loading:true,					// 如果有加载效果
		param:{},						// 参数
		pullLoading:'pullLoading',		// 加载判断
		loadingText:'数据加载中...',			
//		onSuccess:null,			// 改变数据
//		onError:null,
//		noToken:false,
//		isBody:false,
//		isFullApi:false,
//		closeToast:false,
		...option
	}
	
<span class="cstat-no" title="statement not covered" >	if(_this) <span class="cstat-no" title="statement not covered" >_</span>this[opt.pullLoading] = true</span>
<span class="cstat-no" title="statement not covered" >	opt.loading &amp;&amp; $fn.loading(true,opt.loadingText)</span>
	
	// 格式化时间
	let format = <span class="cstat-no" title="statement not covered" >null;</span>
	
<span class="cstat-no" title="statement not covered" >	if($fn.hasArray(opt.format)){</span>
<span class="cstat-no" title="statement not covered" >		format = {</span>
			f:opt.format,
			t:'ymd'
		}
	}else <span class="cstat-no" title="statement not covered" >if($fn.hasObject(opt.format)){</span>
<span class="cstat-no" title="statement not covered" >		format = {</span>
			f:[],		// 格式化字段名
			t:'ymd', 	// 格式化格式
			...opt.format
		}
	}
	
<span class="cstat-no" title="statement not covered" >	return new Promise(<span class="fstat-no" title="function not covered" >(</span>resolve,reject)=&gt;{</span>
<span class="cstat-no" title="statement not covered" >		get(api,opt.param,{</span>
			onStart:<span class="fstat-no" title="function not covered" >()=&gt;</span>{ <span class="cstat-no" title="statement not covered" >opt.onStart &amp;&amp; opt.onStart(true) },</span>
			onEnd:<span class="fstat-no" title="function not covered" >()=&gt;</span>{
<span class="cstat-no" title="statement not covered" >				if(_this) <span class="cstat-no" title="statement not covered" >_</span>this[opt.pullLoading] = false</span>
<span class="cstat-no" title="statement not covered" >				opt.loading &amp;&amp; $fn.loading(false)</span>
<span class="cstat-no" title="statement not covered" >				opt.onEnd &amp;&amp; opt.onEnd(false)</span>
			},
			onMsg: opt.onMsg &amp;&amp; ( <span class="fstat-no" title="function not covered" >data =&gt; </span>{ <span class="cstat-no" title="statement not covered" >$fn.isFunction(opt.onMsg) &amp;&amp; opt.onMsg(data) })</span>,
			noError:opt.noError,
			onError:<span class="fstat-no" title="function not covered" >()=&gt;</span>{
				// 出错，清空 data
<span class="cstat-no" title="statement not covered" >				setType(_this,opt.dataName)</span>
<span class="cstat-no" title="statement not covered" >				opt.onError &amp;&amp; opt.onError();</span>
				
<span class="cstat-no" title="statement not covered" >				if(!opt.loading){ <span class="cstat-no" title="statement not covered" >$fn.loading(false) }</span></span>
			},
			noToken:opt.noToken,
		}).then(<span class="fstat-no" title="function not covered" >data=&gt;</span>{
<span class="cstat-no" title="statement not covered" >			if($fn.isValid(data)){</span>
<span class="cstat-no" title="statement not covered" >				if(opt.hasKey){</span>
<span class="cstat-no" title="statement not covered" >					$fn.addKeys(data, format);</span>
				}
				
<span class="cstat-no" title="statement not covered" >				if($fn.isFunction(opt.onSuccess)){</span>
<span class="cstat-no" title="statement not covered" >					data = opt.onSuccess(data);</span>
				}
				
<span class="cstat-no" title="statement not covered" >				if($fn.isValid(opt.dataName)){</span>
<span class="cstat-no" title="statement not covered" >					if(_this) <span class="cstat-no" title="statement not covered" >_</span>this[opt.dataName] = data</span>
				}
				
<span class="cstat-no" title="statement not covered" >				resolve(data);</span>
			}else{
				let stack = <span class="cstat-no" title="statement not covered" >setType(_this,opt.dataName);</span>
<span class="cstat-no" title="statement not covered" >				resolve(stack);</span>
			}
			
		})
	})
}
// ===================================================== 分页
const <span class="fstat-no" title="function not covered" >paging = <span class="cstat-no" title="statement not covered" >(</span>_this,api,option)=&gt;<span class="cstat-no" title="statement not covered" >{</span></span>
	let opt = <span class="cstat-no" title="statement not covered" >{</span>
		dataName:'data',				// 数据名字
		loading:false,					// 如果有加载效果
		param:{ },						// 参数
		pagingLoading:'pagingLoading',	// 加载判断
		resetData:false,				// 是否重新设置 data，false 不允许
//		format:{},						// 格式化时间
		pag:'pag'
	}
	
<span class="cstat-no" title="statement not covered" >	Object.assign(opt,option || {});</span>
	
	const { page, pageSize } = <span class="cstat-no" title="statement not covered" >opt.param || {}</span>
	const <span class="cstat-no" title="statement not covered" >param = {</span>
		page: page || 1, 			// 当前页
		limit: pageSize || 10,		// 每页显示多少条数据
		...opt.param
	}
<span class="cstat-no" title="statement not covered" >	delete param.pageSize</span>
<span class="cstat-no" title="statement not covered" >	delete param.total</span>
	
	// 格式化时间
	let format = <span class="cstat-no" title="statement not covered" >null;</span>
	
<span class="cstat-no" title="statement not covered" >	if($fn.hasArray(opt.format)){</span>
<span class="cstat-no" title="statement not covered" >		format = {</span>
			f:opt.format,
			t:'ymd'
		}
	}else <span class="cstat-no" title="statement not covered" >if($fn.hasObject(opt.format)){</span>
<span class="cstat-no" title="statement not covered" >		format = {</span>
			f:[],		// 格式化字段名
			t:'ymd', 	// 格式化格式
			...opt.format
		}
	}
	
<span class="cstat-no" title="statement not covered" >	return new Promise(<span class="fstat-no" title="function not covered" >(</span>resolve)=&gt;{</span>
<span class="cstat-no" title="statement not covered" >		pull(_this,api,{</span>
			onStart:<span class="fstat-no" title="function not covered" >()=&gt;</span>{ <span class="cstat-no" title="statement not covered" >opt.onStart &amp;&amp; opt.onStart(true) },</span>
			onEnd:<span class="fstat-no" title="function not covered" >()=&gt;</span>{ <span class="cstat-no" title="statement not covered" >opt.onStart &amp;&amp; opt.onEnd(true) },</span>
			onError:opt.onError,
			loading:opt.loading,
			param: param ,
			pullLoading:opt.pagingLoading,
			resetData:true,
			dataName: null
		}).then(<span class="fstat-no" title="function not covered" >data=&gt;</span>{
<span class="cstat-no" title="statement not covered" >			_this[opt.pag] = {</span>
				..._this[opt.pag],
				current		: +data.current, 			// 当前页码
				total		: +data.total_items,			// 总共多少条数据
				totalPage	: +data.total_pages,			// 总共多少页
				pageSize	: +data.limit,				// 每页显示多少条数据
			}
<span class="cstat-no" title="statement not covered" >			if($fn.isValid(opt.dataName)){</span>
//				const result = $fn.addKey(data, format);
<span class="cstat-no" title="statement not covered" >				_this[opt.dataName] = data.items</span>
<span class="cstat-no" title="statement not covered" >				resolve(data.items)</span>
			}
<span class="cstat-no" title="statement not covered" >			opt.callback &amp;&amp; opt.callback(data);</span>
		})
	})
}
export default { submit, pull, paging }</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 01 2020 02:59:20 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="..\..\prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="..\..\sorter.js"></script>
</body>
</html>
